/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mathma;

/**
 * A completely static class for global operations, such as versioning.
 *
 * @since 0.2.0
 * @author Ethan Levine
 */
public class Mathma {

    private final static String version = "0.2.6";

    /**
     * Gets the version of Mathma currently running.
     *
     * @return The running version of Mathma.
     */
    public static String version() {
        return version;
    }

    /**
     * Enforces that a specific version of Mathma is running.  If the given
     * version does not match the running version, an
     * UnsupportedOperationsException is thrown.
     *
     * @param enforcedVersion The version to enforce.
     * @throws UnsupportedOperationException If the enforced version does not
     * match the running version.
     */
    public static void enforceVersion(String enforcedVersion) {
        if (!enforcedVersion.equals(version)) {
            throw new UnsupportedOperationException("Tried using version \"" +
                    enforcedVersion + "\", but running version \"" + version + "\"");
        }
    }
}
